<template>
	<view class="box">
		<view class="kong"></view>
		<view class="top">
			<image class="back" src="../../static/image/ico_dh_bk@2x.png" mode="" @click='goback'></image>
			<view class="">简历详情</view>
			<image class="xiazai" src="../../static/image/fxzl_ico_xz@2x.png" @click='godown'></image>
		</view>
		<view class="kong_border">
			<view class="moban">{{jinalidetail.title}}</view>
		</view>
		<view class="jiben_boxs">
			<view class="ran flexs1">
				<view class="kong_color"></view>
				<view class="jiben_box">基本信息</view>
			</view>
			<view class="student">
				<view class="student_list flexs1">
					<view class="student_name">文件分类</view>
					<view class=" student_center flexs1" v-if='jinalidetail.cate'>{{jinalidetail.cate.name}}</view>
				</view>
				<view class="student_list flexs1">
					<view class="student_name">更新时间</view>
					<view class=" student_center flexs1">{{jinalidetail.updatetime}}</view>
				</view>
				<view class="student_list flexs1 ">
					<view class="student_name">上传者</view>
					<view class=" student_center border_nun flexs1">{{jinalidetail.author}}</view>
				</view>
				<view class="student_list flexs1 ">
					<view class="student_name">浏览量</view>
					<view class=" student_center border_nun flexs1">{{jinalidetail.read_num}}</view>
				</view>
			</view>
		</view>
		<view class="kong_f"></view>
		<view class="next">
			<view class="ran flexs1">
				<view class="kong_color"></view>
				<view class="jiben_box">资料简介</view>
			</view>
			<view class="next_center">
				资料简介:{{jinalidetail.description}}
			</view>
		</view>
		<view class="kong_f"></view>
		<view class="pingjia" v-if='commentlist'>
			<view class="flexs2">
				<view class="flexs1">
					<view class="kong_color"></view>
					<view class="jiben_box">用户评价({{commentlist.length}})</view>
				</view>

			</view>
			<view class="pingjia_list" v-for="(item,index) in commentlist" :key="index">
				<view class="pingjia_top flexs1">
					<image :src="picture.getImgUrl(item.user.avatar)" mode=""></image>
					<view class="">
						<view class="pingjia_user">{{item.user.nickname}}</view>
						<view class="pingjia_minut">{{item.time_info}}</view>
					</view>
				</view>
				<view class="pingjia_center">{{item.comment}}</view>
			</view>
		</view>
		<view class="kong_ff"></view>
		<view class="btm_box">
			<view class="input_box">
				<input type="text" v-model="commentvalue" placeholder="请输入评论内容" placeholder-class="input_class" />
				<view class="input_btn" @click='sendvoice'>发表</view>
			</view>
			<!-- <view class="coll_box" >
				<image src="../../static/image/sjxq_ico_sc_nor@2x.png" mode="" @click="Collection(1)" v-show="collStatus==2"></image>
				<image src="../../static/image/szrd_img_sc_sel@2x.png" mode="" @click="Collection(2)" v-show="collStatus==1"></image>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {resumeread,resumecomment,resumedownLoad} from '@/api/data.js'
	export default {
		data() {
			return {
				id: '',
				jinalidetail: '',
				commentvalue: '',
				commentlist: '',
				collStatus: 1,
				luj: ''
			}
		},
		onLoad(option) {
			this.id = option.id
			this._resumesdetail()
		},
		methods: {
			_resumesdetail() {
				let obj = {
					id: this.id
				}
				resumeread(obj).then(res => {
					if (res.code == 1) {
						this.jinalidetail = res.data
						this.commentlist = res.data.comment
					} else {
						this.$msg(res.msg)
					}
				})
			},
			sendvoice() {
				let obj = {
					content: this.commentvalue,
					resume_id: this.id
				}
				resumecomment(obj).then(res => {
					if (res.code == 1) {
						// 评论成功后重新获取评论列表
						this._resumesdetail()
					} else {
						this.$msg(res.msg)
					}
				})
			},
			godown() { //下载
				var that = this
				let obj = {
					id: this.id
				}
				resumedownLoad(obj).then(res => {
					if (res.code == 1) {
						console.log(5555)
						uni.downloadFile({
							url:this.picture.getImgUrl(res.data.download_src), //仅为示例，并非真实的资源
							success: (res) => {
								uni.saveFile({
									tempFilePath: res.tempFilePath,
									success: function(red) {
										that.luj = red.savedFilePath
										uni.showToast({
											icon:'none',
											title:'下载成功'+red.savedFilePath
										})
										that.$msg(red.savedFilePath)
									}
								});
							}
						})
					} else {
						this.$msg(res.msg)
					}
				})
			},
			goback() {
				uni.navigateBack({
					delta: 1
				})
			},

		}
	}
</script>

<style>
	.box {
		width: 100%;
		height: 100%;
		background-color: #F5F5F5;
	}

	.top {
		width: 100%;
		height: 100rpx;
		display: flex;
		justify-content: space-between;
		padding: 0 30rpx;
		align-items: center;
		background-color: #FFFFFF;
	}

	.kong_f {
		width: 100%;
		height: 20rpx;
	}

	.kong_ff {
		width: 100%;
		height: 130rpx;
	}

	/* btm */
	.btm_box {
		width: 100%;
		height: 98rpx;
		background: #FFFFFF;
		position: fixed;
		bottom: 0rpx;
		padding: 0 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-top: 1rpx solid #E5E5E5;
	}

	.input_box {
		width: 689rpx;
		height: 58rpx;
		background: #F5F5F5;
		border-radius: 10rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;

	}

	input {
		width: calc(689rpx - 140rpx);
		height: 100%;
		padding: 0 21rpx;
		font-size: 26rpx;
	}

	.input_class {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.input_btn {
		width: 140rpx;
		height: 58rpx;
		background: linear-gradient(126deg, #FFDD47, #FCB630);
		border-radius: 10rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}

	/* pingjia */
	.pingjia {
		width: 100%;
		padding: 20rpx 30rpx;
		height: auto;
		background-color: #FFFFFF;
	}

	.pingjia_list {
		width: 100%;
		margin-top: 10rpx;
	}

	.pingjia_center {
		font-size: 28rpx;
	}

	.pingjia_user {
		font-size: 30rpx;
	}

	.pingjia_minut {
		font-size: 24rpx;
		color: #999999;
	}

	.image_next {
		width: 12rpx;
		height: 22rpx;
	}

	.pingjia_more {
		color: #666666;
		font-size: 22rpx;
		margin-right: 10rpx;
	}

	.pingjia_top {
		width: 100%;
		height: 100rpx;
	}

	.pingjia_top image {
		width: 70rpx;
		height: 70rpx;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	/* next */
	.next {
		width: 100%;
		height: auto;
		background-color: #FFFFFF;
	}

	.next_center {
		width: 100%;
		height: auto;
		padding: 0 30rpx 20rpx 30rpx;
		color: #333333;
		font-size: 28rpx;
	}

	/* student */
	.jiben_box {
		width: 100%;
		height: auto;
		background-color: #FFFFFF;
		font-size: 34rpx;
	}

	.jiben_boxs {
		width: 100%;
		height: 461rpx;
		background-color: #FFFFFF;
	}

	.student {
		width: 650rpx;
		height: 332rpx;
		background: #FFFFFF;
		box-shadow: 0px 2rpx 10px 0rpx rgba(15, 11, 2, 0.13);
		border-radius: 10rpx;
		margin: 0 auto;
		padding: 0 20rpx;
		margin-bottom: 30rpx;
	}

	.student_list {
		height: 84rpx;
	}

	.student_name {
		width: 120rpx;
		font-size: 24rpx;
		color: #666666;
		margin-right: 15rpx;
	}

	.student_center {
		width: 500rpx;
		height: 100%;
		color: #333333;
		font-size: 24rpx;
		border-bottom: solid 1rpx #E5E5E5;
	}

	.back {
		width: 20rpx;
		height: 36rpx;
	}

	.xiazai {
		width: 36rpx;
		height: 36rpx;
	}

	.kong {
		width: 100%;
		height: var(--status-bar-height);
		background-color: #FFFFFF;
	}

	.kong_border {
		width: 100%;
		height: 110rpx;
		background-color: #F5F5F5;
		display: flex;
		animation: 50%;
	}

	.moban {
		width: 750rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: #FFFFFF;
		opacity: 0.6;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.ran {
		width: 100%;
		line-height: 90rpx;
		padding-left: 30rpx;
		background-color: #FFFFFF;
	}

	.kong_color {
		width: 4rpx;
		height: 20rpx;
		border-radius: 20rpx;
		background-color: #FFDD47;
		margin-right: 10rpx;
	}

	.top_xinxi {
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		font-size: 34rpx;
		margin-top: 30rpx;
	}
</style>
